package cn.alise.qdp.service.admin;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import cn.alise.qdp.mapper.admin.MenuMapper;
import cn.alise.qdp.model.menu.Menu;

@Service
@Transactional(rollbackFor = Exception.class)
public class MenuService {

	@Resource(name = "menuMapper")
	private MenuMapper menuMapper;
	
	public Menu get(Menu args) {
		List<Menu> list = this.list(args);
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		
		return null;
	}
	
	public List<Menu> gets(Map<String, Object> args){
		return this.menuMapper.gets(args);
	}
	
	public List<Menu> list(Menu args) {
		return this.menuMapper.list(args);
	}
	
	public List<Menu> page(Map<String, Object> args) {
		return this.menuMapper.page(args);
	}
	
	public int total(Menu args) {
		return this.menuMapper.total(args);
	}
	
	public int delete(Menu args) {
		return this.menuMapper.delete(args);
	}
	
	public int save(Menu args) {
		return this.menuMapper.insert(args);
	}
	
	public int update(Menu args) {
		return this.menuMapper.update(args);
	}
	
	public List<Menu> getMenuList(Menu args) {
		return this.menuMapper.getMenuList(args);
	}
	
	public List<Menu> getOneList(Menu args) {
		return this.menuMapper.getOneList(args);
	}
	
	public List<Menu> getTwoList(Menu args) {
		return this.menuMapper.getTwoList(args);
	}
	
	public List<Menu> getButtonList(Menu args) {
		return this.menuMapper.getButtonList(args);
	}
	
	public List<Menu> getParentList(Menu args) {
		return this.menuMapper.getParentList(args);
	}
	
	public List<Menu> getOneListInit(Menu args) {
		return this.menuMapper.getOneListInit(args);
	}
	
	public List<Menu> getTwoListInit(Menu args) {
		return this.menuMapper.getTwoListInit(args);
	}
	
	public List<Menu> getParentListByDataHref(Menu args) {
		return this.menuMapper.getParentListByDataHref(args);
	}
}
